package com.scalar.forecast.systemprefs.forms;

import com.scalar.forecast.ForecastActionForm;
import com.scalar.forecast.forecastSetup.ForecastTimeFrame;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletRequest;

import com.scalar.forecast.commons.SessionKeys;

/**
 * @author Basha
 * @version 1.0
 */
public class SystemPreferencesForm extends ForecastActionForm
{
    com.scalar.forecast.systemprefs.SystemPreferences   mSystemPreferences   =  null;
    ForecastTimeFrame forecastTimeFrame = null;

    public void setSystemPreferences( com.scalar.forecast.systemprefs.SystemPreferences systemPreferences )
    {
        mSystemPreferences = systemPreferences;
    }

    public com.scalar.forecast.systemprefs.SystemPreferences getSystemPreferences()
    {
        return  mSystemPreferences;
    }

    public ForecastTimeFrame getForecastTimeFrame()
    {
        return forecastTimeFrame;
    }

    public void setForecastTimeFrame(ForecastTimeFrame forecastTimeFrame)
    {
        this.forecastTimeFrame = forecastTimeFrame;
    }

    public void reset( ActionMapping mapping , HttpServletRequest request )
    {
        String action = request.getParameter( SessionKeys.REQUEST_ACTION );

        //initialising if the variables are null
        if( mSystemPreferences == null )
        {
            mSystemPreferences = new com.scalar.forecast.systemprefs.SystemPreferences();
        }
        if ( forecastTimeFrame == null )
        {
            forecastTimeFrame  = new ForecastTimeFrame();
        }
    }
}
